
abstract class Express{
    private double weight;
    public Express(double weight){
        this.weight=weight;
    }
    public abstract void show();
    public abstract double calPrice();

    public double getWeight() {
        return weight;
    }

    public void setWeight(double weight) {
        this.weight = weight;
    }
}
 class ZTExpress extends Express{
    private  double firstWeight=1;
    private double lastWeight;

     public ZTExpress(double weight) {
         super(weight);
     }

     public double getFirstWeight() {
         return firstWeight;
     }

     public void setFirstWeight(double firstWeight) {
         this.firstWeight = firstWeight;
     }

     public double getLastWeight() {
         return lastWeight;
     }

     public void setLastWeight(double lastWeight) {
         this.lastWeight = lastWeight;
     }

     public ZTExpress(double weight, double firstWeight, double lastWeight){
        super(weight);
        this.firstWeight=firstWeight;
        this.lastWeight=lastWeight;
    }
    public void show(){
        System.out.println("firstWeight:"+firstWeight+"lastWeight:"+lastWeight);
    }
    public double calPrice(){
      if(this.getWeight()<=1){
          return getWeight()*12;
      }
      return 12+(getWeight()-getFirstWeight())*10;

    }
 }
 class SFExpress extends Express{
    public SFExpress(double weight){
        super(weight);
    }
    public double calPrice(){
        return getWeight()*10;
    }
   public void show(){

   }
 }
public class Test {
    private static double calculate(Express e){
      return   e.calPrice();
        }
    public static void main(String[] args) {
        SFExpress sfExpress=new SFExpress(3);
        ZTExpress ztExpress=new ZTExpress(3);
        System.out.println(calculate(sfExpress));
        System.out.println(calculate(ztExpress));

    }
}
